package main.od;

import java.util.Scanner;

public class MatchLongestStr {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String input = scanner.nextLine();
        int left = -1,right = Integer.MAX_VALUE,max = 0;
        for (int i = 0;i < input.length();i++){
            char c = input.charAt(i);
            if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')){
                if (left == -1){
                    left = i;
                }else {
                    right = i;
                    if (right- left > max){
                        max = right - left;
                    }
                    left = right;
                }
            }
        }
        System.out.println(max);
    }

}
